package com.ccb.sc.common.modules.message.service;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ccb.sc.common.modules.message.entity.Message;
import com.ccb.sc.common.modules.message.enums.MessageStatus;
import com.ccb.sc.common.modules.message.enums.MessageType;
import com.ccb.sc.common.modules.message.mapper.MessageMapper;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 会员消息表 服务实现类
 * </p>
 *
 * @author ken
 * @since 2022-08-14
 */
@Service
public class MessageService extends ServiceImpl<MessageMapper, Message> {

    public void create(Long memberId, MessageType messageType, String messageTitle, String messageBody) {
        Message message = new Message();
        message.setMemberId(memberId);
        message.setMessageType(messageType);
        message.setMessageTitle(messageTitle);
        message.setMessageBody(messageBody);
        message.setStatus(MessageStatus.UN_READ);
        this.save(message);
    }
}
